package com.ayq.activiti.manager.subscribe;


import com.ayq.activiti.manager.config.ActivitiRabbitMqConfig;
import com.ayq.activiti.manager.dto.WorkFlowOpinionDTO;
import com.ayq.activiti.manager.service.RabbitMqTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ActivitiTaskOpinionListSubscrib {

    @Autowired
    private RabbitMqTaskService rabbitMqTaskService;

    @RabbitListener(queues = ActivitiRabbitMqConfig.ACTIVITI_TASK_OPINION_LIST_QUEUE,containerFactory = ActivitiRabbitMqConfig.LISTENER_CONTAINER_SINGLE)
    public void message(WorkFlowOpinionDTO workFlowOpinionDTO) {
        try {
            rabbitMqTaskService.upodateTaskOpinionList(workFlowOpinionDTO);
        } catch (RuntimeException e) {
            e.printStackTrace();
            log.error("业务历史审核意见接收消息-任务处理失败", e);
        }
        log.info("业务历史审核意见接收消息{}", workFlowOpinionDTO);
    }
}
